#ifndef _IIC_H
#define _IIC_H

#include "usart.h"
#include "stdio.h"
#include "sys.h"
#include "delay.h"
#include "Stack.h"
#include "Sequeue.h"

#define I2C_PORT GPIOB

#define FAILURE 0
#define SUCCESS 1

#define SCL_Pin 	GPIO_Pin_10
#define SDA_Pin 	GPIO_Pin_11

#define DataSizeMax   64

class IIC{ 

private:
	u8 data[DataSizeMax];
	u8 data_send[DataSizeMax];	
	u8 addr;

public:
	IIC();
	IIC(u8);
	IIC(const IIC&){}
	virtual ~IIC(){}
	virtual void i2c_init(void);
  virtual u8 IIC_Read_Len(u8 len);
	virtual u8 IIC_Write_Len(u8 len,const u8 *buf);
	virtual int set(int i,u8 const (&buf)[DataSizeMax], u8 x);  //0: data  1:data_send  2:addr
	virtual int get(int i,u8 (&buf)[DataSizeMax]);//0: data  1:data_send  2:addr

};












#endif


extern int IIC_GET(u8 addr, int len, u8 (&buf)[DataSizeMax]);

extern int IIC_SEND(u8 addr, int len, u8 *buf);












